package ar.com.ctrln.persistence.dao.factura;

import java.util.Collection;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import ar.com.ctrln.persistence.dao.AbstractHibernateDao;
import ar.com.ctrln.persistence.model.factura.DetalleFactura;

@Repository("detalleFacturaDao")
public class HibernateDetalleFacturaDao extends
		AbstractHibernateDao<DetalleFactura> implements DetalleFacturaDao {

	@SuppressWarnings("unchecked")
	@Override
	@Transactional(readOnly = true)
	public Collection<? extends DetalleFactura> getlistaDetalleByFactura(long id) {
		Query query = getSession().createQuery(
				"Select f.detalles from Factura as f where f.id = ?");
		query.setParameter(0, id);
		return query.list();
	}

}
